12 typedef pair
<int, pair
<node
, node
> > edge
;
13 typedef map
<node
, vector
<edge
> > graph
;
18 int maxCapacity(const node
& start
, const node
& destiny
){
19 priority_queue
<edge
> q(g
[start
].begin(), g
[start
].end());
21 visited
.insert(start
);
25 node w
= e
.second
.second
;
26 if (visited
.count(w
) == 0){
27 maximum
[w
] = min(maximum
[w
], min(e
.first
, maximum
[e
.second
.first
]));
32 vector
<edge
> neighbors
= g
[w
];
33 for (int i
=0; i
<neighbors
.size(); ++i
){
43 while (cin
>> n
>> r
&& n
> 0 && r
> 0){
44 maximum
= vector
<int>(n
+1, INT_MAX
);
49 g
[x
].push_back( edge(d
, make_pair(x
, y
)) );
50 g
[y
].push_back( edge(d
, make_pair(y
, x
)) );
55 cin
>> start
>> destiny
>> people
;
56 cout
<< "Scenario #" << c
++ << endl
;
57 if (start
== destiny
){
58 cout
<< "Minimum Number of Trips = 0" << endl
;
60 cout
<< "Minimum Number of Trips = ";
62 int temp
= maxCapacity(start
, destiny
);
67 cout
<< result
<< endl
;
68 //cout << "MaxCapacity: " << maxCapacity(start, destiny) << endl;